#include <iostream>
#include "tocUtil.h"

using namespace std;

#define INITIAL_BODY_SPEED 0.00005

TOCBody::TOCBody(void)
{
	init();
}

TOCBody::~TOCBody(void) {}

void TOCBody::init(void)
{
	this->x = getRandomCoordinate();
	this->y = getRandomCoordinate();
	this->look = getRandomDir();
	this->speed = INITIAL_BODY_SPEED;

	rgb[0] = 0.0f;
	rgb[1] = 1.0f;
	rgb[2] = 0.0f;
}

GLuint TOCBody::getID(void)
{
	return uuid;
}

void TOCBody::turn(GLuint dir) 
{
	switch(dir) {
	case RIGHT:
		this->look += 1;
		break;

	case LEFT:
		this->look += 3;
		break;

	case BACK:
		this->look += 2;
		break;
	}

	this->look %= 4;
}

GLfloat TOCBody::getX(void)
{
	return this->x;
}

GLfloat TOCBody::getY(void)
{
	return this->y;
}

GLfloat TOCBody::getSpeed(void)
{
	return _getSpeed();;
}

void TOCBody::setXY(GLfloat x, GLfloat y) 
{
	this->x = x;
	this->y = y;
}

void TOCBody::setSpeed(GLfloat speed)
{
	this->speed = speed;
}

void TOCBody::setLook(GLuint look) 
{
	this->look = look;
}


GLfloat TOCBody::_getSpeed(void)
{
	return this->speed;
}

void TOCBody::computeMove(void)
{
	_computeMove();
}

GLuint TOCBody::getLook(void)
{
	return this->look;
}

void TOCBody::drawMe(void)
{
	this->_drawMe();
}
